#include"processBar.h"
#include<unistd.h>

typedef void (*callback_t)(int);
void downLoad(callback_t pf)
{
    int total = 1000;
    int curr = 0;
    while(curr <= total)
    {
        int rate = curr * 100 / total;
        pf(rate);
        //进行着某种下载任务
        curr += 10;
        usleep(50000);
    }

    printf("\n");
    initbar();
}

int main()
{
    printf("downLoad1:\n");
    downLoad(processbar);
    printf("downLoad2:\n");
    downLoad(processbar);
    printf("downLoad3:\n");
    downLoad(processbar);
    return 0;
}



//int main()
//{
//    int total = 1000;
//    int curr = 0;
//    while(curr <= total)
//    {
//        processbar(curr * 100 / total);
//        //进行着某种下载任务
//        curr += 10;
//        usleep(50000);
//    }
//    printf("\n");
//
//    return 0;
//}
